# 工程名字
# 在一个大工程里面可以有多个  *项目*
# 这些项目中，可以是动态静态库，也可以是应用程序
PROJECT(libutil)

# 一些有用的 *变量*
#
# PROJECT_SOURCE_DIR
#
# contains the full path to the root of your project source directory, i.e.
# to the nearest directory where CMakeLists.txt contains the PROJECT() command

# PROJECT_BINARY_DIR
#
# contains the full path to the top level directory of your build tree

# CMAKE_BUILD_TYPE
#
# None Debug Release 等

# 要求的 cmake 版本
# 如果没有这句，会有 warning...
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

SET(CMAKE_BUILD_TYPE Debug)

# PROPERTIES 可以是以下选项
# INCLUDE_DIRECTORIES
# LINK_DIRECTORIES
# INCLUDE_REGULAR_EXPRESSION
# ADDITIONAL_MAKE_CLEAN_FILES
#set_directory_properties(
#  PROPERTIES
#  INCLUDE_DIRECTORIES "/usr/include/oracle/11.2/client"
#  INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/inc")

# save the build result to top-level
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../bin)

list(APPEND CMAKE_CXX_FLAGS "-Wall -ggdb")

AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/src SOURCE_FILES)

# the lib
ADD_LIBRARY(util STATIC
  ${SOURCE_FILES})

INCLUDE_DIRECTORIES(
  ${PROJECT_SOURCE_DIR}/inc)

LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/../lib)

# TARGET_LINK_LIBRARIES(testlib listfile)



